<?php
include './vendor/autoload.php';

use Illuminate\Container\Container;
$container = Container::getInstance();

class Mailer
{
    public function send($receive, $content)
    {
        printf('我给%s发了邮件,内容是：%s', $receive,$content) ;
    }
}

class UserManager
{
    private $mailer;

    public function __construct(Mailer $mailer)
    {
        $this->mailer = $mailer;
    }

    public function register($email,$psw)
    {
        $this->mailer->send($email, '"您已经在 陋室租房 注册成功，请激活"');
    }
}

//$userManager = $container->make(UserManager::class);
//$userManager->register('529303133@qq.com', '111111');

$userManager = new UserManager(new Mailer());
$userManager->register('529303133@qq.com', '111111');



